package JDBC1;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Properties;
import java.io.FileInputStream;
public class TextConn {
    public static void main(String[] args) throws Exception {
        Properties properties = new Properties();
        FileInputStream filelnputStream = new FileInputStream("src\\jdbc.properties");
        properties.load(filelnputStream);
        String user= properties.getProperty("user");
        String password= properties.getProperty("password");
        String url= properties.getProperty("url");
        String driver= properties.getProperty("driver");

        System.out.println("user="+user);
        System.out.println("password = " + password);
        System.out.println("url = " + url);
        System.out.println("driver = " + driver);
        Class.forName(driver);
        Connection connection = DriverManager.getConnection(url, user, password);
        System.out.println("connection = " + connection);
        Statement statement = connection.createStatement();
        String s="select * from emp";
        ResultSet resultSet = statement.executeQuery(s);
//        boolean next=resultSet.next();
//        int anlnt=resultSet.getInt("id");
//        System.out.println("anlnt = " + anlnt);
    }
}